package com.concurrent.fw;

import java.io.IOException;

public class ListenerThread extends Thread {
    int channel;
    MsgHandler process;
    public ListenerThread(int channel, MsgHandler process) {
        this.channel = channel;
        this.process = process;
    }

    public void run() {
        while (true) {
            try {
                Msg m = process.recieveMsg(channel);
                process.handleMsg(m,m.getSrcId(),m.getTag());
            } catch (IOException e) {
                System.err.println(e);
            }
        }
    }
}
